home *** CD-ROM | disk | FTP | other *** search
-
- /* Example of loading iff pic into custom screen */
- /* and then Scaling the BitMap */
-
- x = addlib("apig.library",0,-30,0)
-
- call set_apig_globals()
-
- scr = 0
-
- picture = loadiff("gorilla")
- if picture = '0000 0000'x then
- do
- say "I could not find picture 'GORILLA' "
- end
- else
- do
- picdispID = '00011000'x /* LOWRES */
- call showpic()
- end
-
-
- picture = loadiff("almaden")
- if picture = '0000 0000'x then
- do
- say "I could not find picture 'ALMADEN' "
- end
- else
- do
- picdispID = '00011800'x /* LOWRES HAM */
- call showpic()
- end
-
-
- picture = loadiff("robotarm")
- if picture = '0000 0000'x then
- do
- say "I could not find picture 'ROBOTARM' "
- end
- else
- do
- picdispID = '00019004'x /* HIRES LACE */
- call showpic()
- end
-
-
- exit
-
-
- /* ------------------------------------------------------------ */
-
- showpic:
-
- width = iffwidth(picture)
- height = iffheight(picture)
- depth = iffdepth(picture)
- viewmode = iffviewmode(picture)
- ncolors = iffcolors(picture)
- colors = iffcolortab(picture)
-
- say "Width = " width
- say "Depth = " depth
- say "Height = " height
- say "Viewmode = " viewmode
- say "Numcolors = " ncolors
- say "ColorTab = " d2x(c2d(colors))
-
- scrtaglist = makescrtaglist() /* build tag list for screen */
-
- /* scr = openscreen(0,0,width,height,depth,1,0,viemode,CUSTOMSCREEN,0) */
-
- scr = OPENSCREENTAGLIST(null(),scrtaglist)
- scrrp = getscreenrastport(scr)
-
- z = useiffcolor(picture,scr)
-
- /* the following blit copies the IFF image into the screens rastport */
- z = bltbitmaprastport(picture,0,0,scrrp,0,0,width,height,c2d('00c0'x))
-
- /* if you wanna save it */
- /* x = saveiff(picture,"ram:newpic",colors,viewmode,1) */
- /* x = saveiff(picture,"ram:newpic",colors,viewmode,0) */
-
- wait 2 sec
-
- bmwidth = width / 2
- bmheight = height / 2
-
- scalewidth = width / 2
- scaleheight = height / 2
-
- mybitmap = makebitmap(bmwidth,bmheight,depth)
-
- bms = ALLOCVEC(48,MEMF_CLEAR) /* BitMapScaleArgs structure */
- /* you have to hard code it */
-
- call SETVALUE(bms,0,2,'n',0) /* src X */
- call SETVALUE(bms,2,2,'n',0) /* src Y */
- call SETVALUE(bms,4,2,'n',width) /* src width */
- call SETVALUE(bms,6,2,'n',height) /* src height */
- call SETVALUE(bms,8,2,'n',width) /* Xfactor */
- call SETVALUE(bms,10,2,'n',height) /* Yfactor */
- call SETVALUE(bms,12,2,'n',0) /* dest X */
- call SETVALUE(bms,14,2,'n',0) /* dest Y */
- call SETVALUE(bms,16,2,'n',bmwidth) /* dest width */
- call SETVALUE(bms,18,2,'n',bmheight) /* dest height */
- call SETVALUE(bms,20,2,'n',scalewidth) /* Xfactor */
- call SETVALUE(bms,22,2,'n',scaleheight) /* Yfactor */
- call SETVALUE(bms,24,4,'p',picture) /* source bitmap */
- call SETVALUE(bms,28,4,'p',mybitmap) /* destination bitmap */
-
- /* scale it into mybitmap */
- call BITMAPSCALE(bms)
-
- /* blit mybitmap into screen */
- z = bltbitmaprastport(mybitmap,0,0,scrrp,0,0,bmwidth,bmheight,c2d('00c0'x))
-
- wait 4 sec
-
- call FREEBITMAP(picture)
- call FREEBITMAP(mybitmap)
- call FREEVEC(bms)
-
- call freetagitems(scrtaglist)
-
- x = closescreen(scr)
-
- return 1
-
-
- /* ------------------------------------------------------------ */
-
- makescrtaglist:
-
- scrtagl = ALLOCATETAGITEMS(18)
-
- sapens = MAKEPOINTER(scrtagl,0,24,MEMF_CLEAR)
-
- call SETVALUE(sapens,0,2,'n',-1)
-
- scrpname = MAKEPOINTER(scrtagl,0,80,MEMF_CLEAR)
- call export(scrpname,"MY SCREEN ONE ")
-
- call SETTAGSLOT(scrtagl,0,SA_Title,'p',scrpname)
- call SETTAGSLOT(scrtagl,1,SA_Left,'n',0)
- call SETTAGSLOT(scrtagl,2,SA_Top,'n',0)
- call SETTAGSLOT(scrtagl,3,SA_Width,'n',width)
- call SETTAGSLOT(scrtagl,4,SA_Height,'n',height)
- call SETTAGSLOT(scrtagl,5,SA_DISPLAYID,'p',picdispID) /* picdispID set above */
- call SETTAGSLOT(scrtagl,6,SA_Depth,'n',depth)
- call SETTAGSLOT(scrtagl,7,SA_Type,'n',CUSTOMSCREEN)
- call SETTAGSLOT(scrtagl,8,TAG_DONE,'n',0)
-
- return scrtagl
-
-